<include file='Admin/Tpl/Public/nav.html' />
<style>
.tr:nth-of-type(even){
	background:#D8F6FF;
}
</style>
<div class="page-content">
    <div class="container-fluid">
    	<br/>
        <ol class="breadcrumb default square rsaquo sm">
            <li><a href="index.html"><i class="fa fa-home"></i></a></li>
            <li><a href="#fakelink">Team In</a></li>
            <li><a href="__URL__/index">会议类型</a></li>
            <li class="active">类型修改</li>
        </ol>
        <div class="the-box full no-border">
            <div class="table-responsive">
                <div class="the-box">
            		<form id="ExampleBootstrapValidationForm" method="post" action="__URL__/update_category_act" enctype="multipart/form-data">
                    	<input type="hidden" name="category_id" value="{$cate['category_id']}" />
                        <fieldset>
                            <div class="form-group">
                                <label>当前类型名称</label>
                                <input type="text" class="form-control must" type="text" name="cid" value="{$category.category_name}"/>
                            </div>

                            <div class="form-group">
                                <label>修改类型名称</label>
                                <select class="form-control" id="p" name="first">
                                    <option value="">一级分类</option>
                                    <volist name="data" item="vo">
                                        <option value="{$vo['category_id']">{$vo['category_name']}</option>
                                    </volist>                                                      
                                </select>  
                                <br>
                                <select style="height:30px;" id="c" name="second">
                                    <option value="">二级分类</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <input class="btn btn-primary" id="submit" type="submit" value="提交" />
                            </div>
                        </fieldset>
                	</form>
                </div>
            </div>
        </div>
</div>
</body>
<script>

    // 绑定切换事件
    var op = document.getElementById('p');
    var oc = document.getElementById('c');
    op.onchange = dodo; 
    oc.onchange = dodo; 
    function dodo() {
        var $this = this; // 缓存当前触发事件的对象
        // 当前的ID
        var id = this.value;
        var url = '__URL__/sel/category_id/'+id; // 将所选分类ID 发送到服务器端
        $.get(url,'',function(data) {
            // 判断谁 能区分出当前触发事件的select 
            console.log(data);
            if($this.id == 'p') {
                // 清空option元素
                var obj = oc;
                obj.options.length = 1;
                $("#c").append(data);
                od.style.display = 'none';
            } 
        });
    }
</script>
</html>